Boyle usage

Creating new environment and sample usage


In [1]:
Boyle.list()


Out[1]:
{:ok, []}

In [2]:
Boyle.mk("my_new_env")


All dependencies up to date
Out[2]:
{:ok, ["my_new_env"]}

In [3]:
Boyle.activate("my_new_env")


All dependencies up to date
Out[3]:
:ok

In [4]:
Boyle.install({:number, "~> 0.5.7"})


Resolving Hex dependencies...
Dependency resolution completed:
New:
  decimal 1.5.0
  number 0.5.7
* Getting number (Hex package)
* Getting decimal (Hex package)
==> decimal
Compiling 1 file (.ex)
Generated decimal app
==> number
Compiling 9 files (.ex)
Generated number app
Out[4]:
:ok

In [5]:
Boyle.list()


Out[5]:
{:ok, ["my_new_env"]}

In [6]:
Boyle.active_env_name()


Out[6]:
"my_new_env"

Number library usage


In [7]:
Number.Currency.number_to_currency(2034.46)


Out[7]:
"$2,034.46"

In [8]:
Number.Phone.number_to_phone(1112223333, area_code: true, country_code: 1)


Out[8]:
"+1 (111) 222-3333"

In [9]:
Number.Percentage.number_to_percentage(100, precision: 0)


Out[9]:
"100%"

In [10]:
Number.Human.number_to_human(1234)


Out[10]:
"1.23 Thousand"

In [11]:
Number.Delimit.number_to_delimited(12345678)


Out[11]:
"12,345,678.00"

Deactivating virtual environment


In [12]:
Boyle.deactivate()


Out[12]:
:ok

In [13]:
Boyle.active_env_name()


Out[13]:
nil

In [14]:
# Number library won't work if you deactivate the environment
Number.Currency.number_to_currency(2034.46)


** %UndefinedFunctionError{arity: 1, exports: nil, function: :number_to_currency, module: Number.Currency, reason: nil}

In [14]:
Boyle.activate("my_new_env")


Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  decimal 1.5.0
  number 0.5.7
All dependencies up to date
Out[14]:
:ok

In [15]:
# and if you activate it will work again
Number.Currency.number_to_currency(2034.46)


Out[15]:
"$2,034.46"

In [16]:
Boyle.freeze()


Out[16]:
{%{decimal: {:hex, :decimal, "1.5.0", "b0433a36d0e2430e3d50291b1c65f53c37d56f83665b43d79963684865beab68", [:mix], [], "hexpm"}, number: {:hex, :number, "0.5.7", "da1ee0434f3c7b84360d33b335d0ee2f86f247f45fbe2e7636e6f55680b464dd", [:mix], [{:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"}}, []}

In [17]:
Boyle.list()


Out[17]:
{:ok, ["my_new_env"]}

In [18]:
Boyle.rm("my_new_env")


Out[18]:
{:ok, []}